package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1995 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int countQuadruplets(int[] nums) {
            int ans = 0;
            for (int i = 3; i < nums.length; i++) {
                for (int i1 = i - 1; i1 > 1; i1--) {
                    if (nums[i1] >= nums[i]) continue;
                    for (int i2 = i1 - 1; i2 > 0; i2--) {
                        if (nums[i2] >= nums[i] - nums[i1]) continue;
                        for (int i3 = i2 - 1; i3 >= 0; i3--) {
                            if (nums[i3] > nums[i] - nums[i1] - nums[i2]) continue;
                            ans += nums[i] - nums[i1] - nums[i2] - nums[i3] == 0 ? 1 : 0;
                        }
                    }
                }
            }
            return ans;
        }
    }

    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC1995 an = new LC1995();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
